/**
 * 添加或者修改页面
 */
var LawInfoDlg = {
    data: {
        category: "",
        name: "",
        pic: "",
        summary: "",
        content: "",
        version: "",
        issueNumber: "",
        issueAuthority: "",
        issueDate: "",
        implDate: "",
        status: "",
        sort: "",
        createTime: "",
        updateTime: ""
    }
};

layui.use(['form', 'admin', 'ax','upload','formSelects','layer','func'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var upload = layui.upload;
    var formSelects = layui.formSelects;
    var layer = layui.layer;
    var func = layui.func;

    //让当前iframe弹层高度适应
    admin.iframeAuto();

    // //实例化编辑器
    // var ue = UE.getEditor('content', {
    //     enableAutoSave: false,
    //     autoHeightEnabled: true,
    //     autoFloatEnabled: false,
    //     initialFrameWidth:null,
    //     scaleEnabled: true,         //滚动条
    //     initialFrameHeight: 400     //默认的编辑区域高度
    // });
    //
    // UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    // UE.Editor.prototype.getActionUrl = function (action) {
    //     if (action === 'uploadimage' || action === 'uploadscrawl' || action === 'uploadimage') {
    //         return Feng.ctxPath + '/ueditor/imgUpdate';
    //     } else if (action === 'uploadfile') {
    //         return Feng.ctxPath + '/ueditor/uploadfile';
    //     } else if (action === 'uploadvideo') {
    //         return Feng.ctxPath + '/ueditor/uploadvideo';
    //     } else {
    //         return this._bkGetActionUrl.call(this, action);
    //     }
    // };

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/law/addItem", function (data) {
            Feng.success("添加成功！");

            //传给上个页面，刷新table用
            admin.putTempData('formOk', true);

            //关掉对话框
            admin.closeThisDialog();

        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

});